import type { PublishForm, PublishResponse } from "@/types/publish";
import { request } from "@/utils/https";

/**
 * 上传文章
 */
export  const publishAPI = (data:PublishForm)=>{
   return request<PublishResponse>('/v1_0/mp/articles','POST',data)
}

/**
 * @description: 获取文章详情
 * @param {*}
 * @return {*}
 */
export const ArticleTargetAPI = (id:string)=>{
  return request<PublishForm>(`/v1_0/mp/articles/${id}`,'GET')
}

/**
 * 编辑文章
 */
export const updateAPI = (data:PublishForm,id:string,draft:boolean)=>{
  return request(`/v1_0/mp/articles/${id}?draft=${draft}`,'PUT',data)
}




/**
 * 删除文章
 */
export const delArticleAPI = (id:string)=>{
  return request(`/v1_0/mp/articles/${id}`,'DELETE')
}

